package com.sias.springboot;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.event.ApplicationPreparedEvent;
import org.springframework.context.ApplicationEventPublisher;
import org.springframework.stereotype.Component;

/**
 * @author 吴文杰
 * @version 1.0
 * @since 2023/5/31 14:00
 */
@Component
public class Component1 {
  private static final Logger LOG = LoggerFactory.getLogger(Component1.class);

  @Autowired
  ApplicationEventPublisher context;

  public void register(){
    LOG.debug("用户注册");
    context.publishEvent(new UserRegisteredEvent("this is a message"));
  }

}
